<?php
/**
 * ScreenExceptionReporter class definition
 *   
 * @author Sean Crystal <seancrystal@gmail.com>
 * @package MutantVole
 */
require_once 'interfaces/iExceptionReporter.php';

/**
 * Reports exceptions to the screen
 * @package MutantVole
 * @subpackage Exceptions
 */   
class ScreenExceptionReporter implements iExceptionReporter {
	/**
     * Reports an exception to the browser
	 * @param Exception $e
	 */  	
	public function ReportException(Exception $e) {
		$message = $this->FormatException($e);
		
		echo $message;
	}
	
	/**
     * Formats an exception output for a web browser
	 * @param Exception $e
	 * @return string
	 */   	
	protected function FormatException(Exception $e) {
		$message  = '<b>Uncaught '. get_class($e) .': '. htmlentities($e->getMessage()) .'</b><br><pre>';
		$message .= $e->getTraceAsString();
		
		return $message;
	}
}


?>